/*
    The I Ching (the Book of Changes) plasmoid.
    Copyright (C) 2002-2009 Jean Pierre Charalambos.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef LINE_H
#define LINE_H

#include "datagram.h"

/**
*@author Jean Pierre Charalambos
*/

/*! \brief An I Ching line
\class Line line.h line.h

An I Ching line defines the atomic hexagram element. This class provide means to generate the different kind of lines.

The line is the atomic I Ching entity - that is, it is the only entity that cannot be broken down further. A single
line represents duality, a yin or a yang, and can be in one of two states: stable or changing. That is, a line can
take one of four different forms:

A yin, represented as: a black divided line. Internal Code: 2
A yang, represented as: a black line. Internal Code: 1
A changing yin, represented as: a red divided line. Internal Code: 0
A changing yang, represented as: a red line. Internal Code: 3

Note that the modulo of the internal code of a line by 2 (i.e., getId() % 2) gives 1 for yang and 0 for yin. The
method to generate a line's id (ie., genLine) resembles the throwing of three coins.


The method to generate a line's id (ie., genLine) resembles the throwing of three coins.

\nosubgrouping */

class Line : public Datagram {
        Q_OBJECT
        friend class Trigram;
    public:
        Line() {
            generate();
        }
        Line ( int i ) {
            adjust ( i );
        }
        ~Line() {
            name.clear();
        }

    protected slots:
        virtual void generate();
        virtual void adjust ( int );
        virtual void setName();
};

#endif // LINE_H
